package cn.gson.querydsl.plugin;

import cn.gson.querydsl.dao.Dao;
import cn.gson.querydsl.dao.DaoBeanBuilder;
import cn.gson.querydsl.transaction.HibernateTranInterceptor;
import cn.gson.querydsl.transaction.InjectDsl;
import cn.gson.querydsl.transaction.Transaction;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.core.AppContext;
import org.noear.solon.core.Plugin;

/**
 * <p>****************************************************************************</p>
 * <ul style="margin:15px;">
 * <li>Description : solon的入口插件</li>
 * <li>Version     : 1.0</li>
 * <li>Creation    : 2024年07月19日</li>
 * <li>@author     : ____′↘夏悸</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
@Slf4j
public class QueryDslPluginImpl implements Plugin {
    @Override
    public void start(AppContext context) {
        context.beanBuilderAdd(Dao.class, new DaoBeanBuilder());
        context.beanInjectorAdd(InjectDsl.class, new QueryFactoryInjector());
        context.beanInterceptorAdd(Transaction.class, new HibernateTranInterceptor(), 1);
    }
}
